/**
 * This is my code.
 *
 * $Id$
 */
package fi.jab.esb.config.xml.impl;

import fi.jab.esb.config.xml.FsListenerType;
import fi.jab.esb.config.xml.FsMessageFilterType;
import fi.jab.esb.config.xml.XmlPackage;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Fs Listener Type</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link fi.jab.esb.config.xml.impl.FsListenerTypeImpl#getFsMessageFilter <em>Fs Message Filter</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class FsListenerTypeImpl extends AbstractScheduledListenerImpl implements FsListenerType
{
  /**
   * The cached value of the '{@link #getFsMessageFilter() <em>Fs Message Filter</em>}' containment reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getFsMessageFilter()
   * @generated
   * @ordered
   */
  protected FsMessageFilterType fsMessageFilter;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected FsListenerTypeImpl()
  {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return XmlPackage.Literals.FS_LISTENER_TYPE;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public FsMessageFilterType getFsMessageFilter()
  {
    return fsMessageFilter;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetFsMessageFilter(FsMessageFilterType newFsMessageFilter, NotificationChain msgs)
  {
    FsMessageFilterType oldFsMessageFilter = fsMessageFilter;
    fsMessageFilter = newFsMessageFilter;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, XmlPackage.FS_LISTENER_TYPE__FS_MESSAGE_FILTER, oldFsMessageFilter, newFsMessageFilter);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setFsMessageFilter(FsMessageFilterType newFsMessageFilter)
  {
    if (newFsMessageFilter != fsMessageFilter)
    {
      NotificationChain msgs = null;
      if (fsMessageFilter != null)
        msgs = ((InternalEObject)fsMessageFilter).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - XmlPackage.FS_LISTENER_TYPE__FS_MESSAGE_FILTER, null, msgs);
      if (newFsMessageFilter != null)
        msgs = ((InternalEObject)newFsMessageFilter).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - XmlPackage.FS_LISTENER_TYPE__FS_MESSAGE_FILTER, null, msgs);
      msgs = basicSetFsMessageFilter(newFsMessageFilter, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, XmlPackage.FS_LISTENER_TYPE__FS_MESSAGE_FILTER, newFsMessageFilter, newFsMessageFilter));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
  {
    switch (featureID)
    {
      case XmlPackage.FS_LISTENER_TYPE__FS_MESSAGE_FILTER:
        return basicSetFsMessageFilter(null, msgs);
    }
    return super.eInverseRemove(otherEnd, featureID, msgs);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case XmlPackage.FS_LISTENER_TYPE__FS_MESSAGE_FILTER:
        return getFsMessageFilter();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case XmlPackage.FS_LISTENER_TYPE__FS_MESSAGE_FILTER:
        setFsMessageFilter((FsMessageFilterType)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case XmlPackage.FS_LISTENER_TYPE__FS_MESSAGE_FILTER:
        setFsMessageFilter((FsMessageFilterType)null);
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case XmlPackage.FS_LISTENER_TYPE__FS_MESSAGE_FILTER:
        return fsMessageFilter != null;
    }
    return super.eIsSet(featureID);
  }

} //FsListenerTypeImpl
